/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-03-21
 * Time:16:20
 */
public class TestDemo {
    public static void main(String[] args) {
        int arr[]={5,4,3,2,1};
        int tmp=0;
        long t1 = System.currentTimeMillis();
        for (int i = 0; i < arr.length; i++) {
            for(int j = 0;j < arr.length - 1 - i; j++){
                if(arr[j]>arr[j+1]){
                    tmp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=tmp;
                }
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
        long t2 = System.currentTimeMillis();
        System.out.println("运行时间是"+(t2-t1)+"ms");
    }
}
